package com.airena.controller;

import com.airena.entity.po.ChatMessage;
import com.airena.entity.vo.RoleInfoVo;
import com.airena.result.Result;
import com.airena.service.IChatMessageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 聊天记录接口
 */
@RestController
@Slf4j
@Tag(name = "聊天记录接口")
@RequestMapping("/chatMessage")
public class ChatMessageController {

    @Autowired
    private IChatMessageService chatMessageService;


    /**
     * 查询当前用户聊天记录列表
     */
    @Operation(summary = "查询当前用户聊天记录列表")
    @GetMapping
    public Result<RoleInfoVo> getChatMessageList() {
        return chatMessageService.getChatMessage();
    }


    /**
     * 根据memoryId查询详细聊天记录
     *
     * @param memoryId
     * @return
     */
    @Operation(summary = "查询角色详细聊天记录")
    @GetMapping("/{memoryId}")
    public Result<ChatMessage> getChatMessageList(@PathVariable String memoryId) {
        return chatMessageService.getChatMessageList(memoryId);
    }
}
